﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ABulletC : ABullet
{
    //玩家子弹速度继承于父类
    //敌人子弹速度测算公式： 每帧像素(1.6)*帧率(60)/每单位像素(16)=6


    private void Awake()
    {
        gameObject.SetActive(false);
        rig = GetComponent<Rigidbody2D>();
    }
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        CommonFly();
    }
    private void FixedUpdate()
    {
    }

    private void OnDestroy()
    {
        this.CommonOnDestroy();
    }

    protected override void Hit(GameObject target)
    {
        this.CommonHit(transform.position, target);
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject target = collision.gameObject;
        //string layerName=LayerMask.LayerToName(target.layer);

        Hit(target);

        //if (this.enemyLayerNames.IndexOf(layerName) >= 0)
        //{
        //    Hit(target);
        //}else if (this.blockLayerNames.IndexOf(layerName) >= 0)
        //{
        //    Hit(target);
        //}
    }
}
